import request from '@/utils/request'

// 获取角色列表
// page 当前页
// pagesize 每页容量
export const getRoleListApi = (page, pagesize) => {
  return request({
    url: '/sys/role',
    params: {
      page,
      pagesize
    }
  })
}

// 删除角色
export const delRoleListApi = (id) => {
  return request({
    url: `/sys/role/${id}`,
    method: 'DELETE'
  })
}

// 添加角色
export const addRoleListApi = (data) => {
  return request({
    url: '/sys/role',
    method: 'POST',
    data
  })
}

// 获取角色详情
export const getRoleDateApi = (id) => {
  return request.get(`/sys/role/${id}`)
}

// 修改角色
export const editRoleListApi = (data) => {
  return request({
    url: `/sys/role/${data.id}`,
    method: 'PUT',
    data
  })
}

// 获取公司信息
export const getCompanyInfoApi = (id) => {
  return request.get(`/company/${id}`)
}

// 给角色分配权限
export const assignPermApi = (data) => {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
